package com.example.exp8;

import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.View;

import java.util.logging.Filter;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.layout);

        Department_Leader department_leader = new Department_Leader();
        IntentFilter filter01 = new IntentFilter("Message");
        filter01.setPriority(1000);
        registerReceiver(department_leader, filter01);

        Counsellor counsellor = new Counsellor();
        IntentFilter filter02 = new IntentFilter("Message");
        filter02.setPriority(500);
        registerReceiver(counsellor, filter02);

//        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
//            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
//            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
//            return insets;
//        });
    }

    public void send(View v){
        Intent intent = new Intent();
        intent.setAction("Message");
        intent.putExtra("notification", "明天下午在阶九开会");
        sendOrderedBroadcast(intent, null);
    }
}